<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./axios.min.js"></script>
</head>
<body>
    <!-- 
        我们使用axios发送ajax
     -->
     账号: <input type="text" placeholder="请输入账号" id="username"><br>
     密码: <input type="text" placeholder="请输入密码" id="password"><br>
     <button onclick="registerHandler()">发送</button>
     <script>
        /* 
            当我们点击发送按钮的时候,那么获取到账号密码
            将账号密码通过axios请求,发送给服务器
        */
        function registerHandler(){
            const username = document.getElementById("username").value;
            const password = document.getElementById("password").value;
            axios({
                url:"http://localhost:8080/login",
                method:"post",
                data:{username,password}
            })
            .then(res=>{
                //axios里面的内容都是在res.data里面
                console.log(res.data);
            })
        }
     </script>
</body>
</html>